package org.jeecg.enums.base;

/**
 * 房间属性
 */
public enum BaseRoomTypeEnum {
    BASE_ROOM_PROPERTY_USE(1, "使用权房"),
    BASE_ROOM_PROPERTY_DELIVERY(2, "保产房"),
    BASE_ROOM_PROPERTY_COMMERCIAL(3, "商品房"),
    BASE_ROOM_PROPERTY_IDLE(4, "空房"),
    BASE_ROOM_PROPERTY_FOLLOW(5, "售后公房"),
    BASE_ROOM_PROPERTY_FOLLOW_SPECIAL(6, "售后公房(商)"),
    BASE_ROOM_PROPERTY_VILLA(7, "联排别墅"),
    BASE_ROOM_PROPERTY_DOUBLE(8, "复式"),
    BASE_ROOM_PROPERTY_TOWNHOUSE(9, "联排"),
    BASE_ROOM_PROPERTY_FLATS(10, "公寓"),
    ;

    private Integer code;
    private String desc;

    BaseRoomTypeEnum(Integer code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public Integer getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }


    public static String getDesc(Integer value) {
        if (value == null) return "";
        BaseRoomTypeEnum[] enums = values();
        for (BaseRoomTypeEnum typeEnum : enums) {
            if (value.intValue()  == typeEnum.getCode().intValue()) {
                return typeEnum.desc;
            }
        }
        return "";
    }

    public static Integer getValue(String desc) {
        BaseRoomTypeEnum[] enums = values();
        for (BaseRoomTypeEnum typeEnum : enums) {
            if (typeEnum.getDesc().equals(desc)) {
                return typeEnum.code;
            }
        }
        return null;
    }

}
